﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Core;

namespace DataAccess.Classes
{
   public class DatPhong1
   {
       public int IDDatPhong { get; set; }
       public string IDNguoiDung { get; set; }
       public int IDPhongTro { get; set; }
       public string Email { get; set; }
       public string SoDT { get; set; }
       public string DiaChi { get; set; }
       public DateTime NgayDat { get; set; }

       public DatPhong1() { }
       public static List<DatPhong1> DanhSachDatPhongIDNguoiDung(string user)
       {
           try
           {
               return CBO.FillCollection<DatPhong1>(DataProvider.Instance.ExecuteReader("DatPhong_IDNguoiDung", user));
           }
           catch
           { return null; }
       }
       public static List<DatPhong1> LayDanhSach()
       {
           try
           {
               return CBO.FillCollection<DatPhong1>(DataProvider.Instance.ExecuteReader("DatPhong_All"));
           }
           catch
           {
               return null;
           }
       }
       public static bool Them(DatPhong1 dp)
       {
           try
           {
               object rs = DataProvider.Instance.ExecuteNonQueryWithOutput("IDDatPhong", "DatPhong_Them", dp.IDDatPhong, dp.IDNguoiDung, dp.IDPhongTro, dp.Email, dp.SoDT, dp.DiaChi, dp.NgayDat);
               return Convert.ToInt32(rs) > 0;
           }
           catch
           {
               return false;
           }
       }
   }
}
